#!/bin/bash
#linux core dump files removal tool
#this script just find linux core dump files on all /home folders and show it path and size and ask you to confirm 
#as it shown on 
#http://gabrielharper.com/blog/2009/05/finding-deleting-linux-core-dump-files-safely/
#to delete the file or not

echo ""
echo "core dumps core.* files removal tool"
echo "dev: uidequalzero"
echo "v0.0-alpha"
echo "core file must begin with core.* and * can be number"
echo ""
echo "comes with GPL v3 licnese"
echo "============================"
echo ""

if [ "$(id -u)" != "0" ]; then
   echo -e "\e[00;31mThis script must be run as root\e[00m" 1>&2
   echo "" 1>&2
   exit 1
fi


find /home/ -regex ".*/core.[0-9][0-9][0-9][0-9]$" -type f -print  -exec /bin/ls -lh {} \; -exec rm  -i {} \;
